#include "searchbox.h"
#include "ui_searchbox.h"

SearchBox::SearchBox(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SearchBox)
{
    ui->setupUi(this);
    flag=SF_NONE;
}

SearchBox::~SearchBox()
{
    delete ui;
}

void SearchBox::on_AMD_toggled(bool checked)
{
    if(checked)
    {
        ui->intel->setChecked(false);
        flag=SF_AMD;
    }
}

void SearchBox::on_intel_toggled(bool checked)
{
    if(checked)
    {
        ui->AMD->setChecked(false);
        flag=SF_INTEL;
    }
}

void SearchBox::on_kw_returnPressed()
{
    QString kw=ui->kw->text();
    if(kw.isEmpty())
        return;

    emit request(flag,kw);
    if(ui->AMD->isChecked())
        ui->AMD->setChecked(false);
    if(ui->intel->isChecked())
        ui->intel->setChecked(false);
    ui->kw->clear();
    hide();
}
